#ifndef		__ENGINE_COMMANDLINE_H_INCLUDED__
#define		__ENGINE_COMMANDLINE_H_INCLUDED__

#include	"Strings.h"
#include	<map>

/**
 * Parsing command line arguments.
 */
class Commandline {
public:
	Commandline(int argc, char * argv[]);

	/**
	 * Did command line arguments have given key?
	 *
	 * \param key Key for setting.
	 * \return Given key exists?
	 */
	bool Has(const char * key) const;

	/**
	 * Get command line argument value.
	 *
	 * \param key Argument name.
	 * \return Argument value.
	 */
	template<typename T>
	T Get(const char * key, T def) const {
		auto it = _parsed.find(key);
		if (it == _parsed.end()) {
			return def;
		} else {
			return Parse<T>(it->second);
		}
	}
	
private:
	std::map<std::string, std::string> _parsed;
};

#endif//!	__ENGINE_COMMANDLINE_H_INCLUDED__
